#pragma once
/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework Class Library
 * Version 2.00
 * 
 * DNS Text Record Structure
 *      Represents a DNS text (TXT) record.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
#include "stdafx.h"
using namespace System;
using namespace System::Net;
using namespace System::Collections;
using namespace System::Collections::Specialized;

namespace Adaptive
{
	namespace Network
	{
		namespace Dns
		{
			/// <summary>
			/// Represents a DNS text (TXT) record.
			/// </summary>
			public value struct DnsTextRecord
			{
			internal:
				/// <summary>
				/// Initializes a new instance of the class from the unmanaged record.
				/// </summary>
				/// <param name="record"> A pointer to a DNS_RECORD structure whose contents are to be copied.</param>
				DnsTextRecord(DNS_RECORD* record)
				{
					int length = 0;
					int count = 0;

					if (record == NULL)
					{
						StringData = nullptr;
					}
					else
					{
						StringData = gcnew StringCollection();
						length = record->Data.TXT.dwStringCount;
						for(count = 0; count < length; count++)
							StringData->Add( gcnew String ( record->Data.TXT.pStringArray[count] ));
					}
				}
			private:
				/// <summary>
				/// Static constructor.
				/// </summary>
				static DnsTextRecord()
				{
				}
			public:

				/// <summary>
				/// Strings representing the descriptive text of the TXT resource record.
				/// </summary>
				/// <value>
				/// A <see cref="StringCollection"/> instance containing the data, or <b>null</b>.
				/// </value>
				StringCollection^	StringData;
			};
		}
	}
}